<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>全部医院</title>
    <titleType style="display: none;">qbyy</titleType>
    <link rel="stylesheet" href="/static/css/qyjm/page.css"/>
    <%- include('../../_global/baseLibs') %>
</head>
<style>
    body{
        background: #fbfafa;
    }
    .hosItem{padding: 10px;display: -webkit-flex;}
    .hosItem-left{width: 30%;overflow: hidden;}
    .hosImg{width: 6rem;height:6rem;border-radius: 100%;}
    .hosLevel{border: #4a95e6 solid 1px;padding: 2px 4px;border-radius: 4px;font-size: 12px;color: #00bbee;margin-left: 10px;}
    .hosItem-right{width: 100%;padding-left: 10px;padding-right: 10px;position:relative;}
    .hosItem-right>.address{font-weight: bold;font-size: 16px;}
    .hosItem-bottom{display: -webkit-flex;-webkit-justify-content: space-between;-webkit-align-items: center;position: absolute;bottom:0;width: 90%;}
    .addDetail{color: #777;font-size: 12px;width:50%;}
    .hosItem-bottom-red{color: red;font-weight: bold;font-size: 14px;padding: 0px 10px;}
    .mark{width: 12px;height: 12px;}
    .hosItem-bottom span{vertical-align: middle;}
    #queryInput{
        width: 94%;
        height: 2.4rem;
        border-radius: 5px;
        border: none;
        background: #f1f1f1;
        margin: 0.5rem 3%;
        font-size: 1.2rem;
        text-indent: 0.2rem;
        text-align: center;
    }
</style>

<body>
<header class="header-box grey fixed">
    <div class="header-content">
        <div class="left-tool">
            <a class="back" href="javascript:void(0);"><i class="iconfont icon-back"></i></a>
        </div>
        <div class="title">更多医院</div>
    </div>
</header>
<section class="page-wrap yygh-box">
    <div class="search">
        <form action="javascript:;" >
            <input placeholder="搜索医院" type ="search" id="queryInput" oninput="search(this.value)" >
        </form>
    </div>

    <div class="doctor-list-box" id="hosDiv" style="margin-top:0;">
        <ul id="hosUl">
        </ul>
    </div>
</section>
<div class="contain">
    <ul class="hosList"></ul>
</div>
</body>
<script src="/quickJs/scripts/swiper/3.4.2/js/swiper.min.js"></script>
<script>
        var level = (localStorage.getItem('level'))? '0'+localStorage.getItem('level') : '03'
        var pageNumber = 0;//初始化页数
        getHos(0)//初始化获取医院
        var range = 0;             //距下边界长度/单位px
        var totalheight = 0;
        $(window).scroll(function(){
            var srollPos = $(window).scrollTop();    //滚动条距顶部距离(页面超出窗口的高度)
            totalheight = parseFloat($(window).height()) + parseFloat(srollPos);
            if(($(document).height()-range) <= totalheight ) {
                pageNumber++
                getHos(pageNumber)
            }
        });
        $('body').on('click','.hosItem',function () {
            var obj = {
                hosId : $(this).attr("data-id"),
                hosName: $(this).find('.hosName').text()
            }
            if(localStorage.getItem('level') === '1'){
                localStorage.setItem('hosInfo1', JSON.stringify(obj))
            }else if(localStorage.getItem('level') === '2'){
                localStorage.setItem('hosInfo2', JSON.stringify(obj))
            }else if(localStorage.getItem('level') === '3'){
                localStorage.setItem('hosInfo3', JSON.stringify(obj))
            }else{
                localStorage.setItem('hosInfo', JSON.stringify(obj))
            }
            history.go(-1)
        });
        function search(val) {
            level = "";
            getHos(0,val)
        }
    function getHos(pageNumber,hospitalName) {
        sessionStorage.setItem('hospitalName',hospitalName)
        if(pageNumber == 0){
            $('.hosList').html(' ')
        }
        $.QuickRemote.AjaxJson({
            funcName: "/api/gzd/qyfw/level"
            ,params: {level: level,pageNumber:pageNumber,pageSize:10,hospitalName:(sessionStorage.getItem('hospitalName') || '')}
            ,callback: function(result) {
                var html="";
                for(var i = 0;i < result.length;i++){
                    var hos = result[i]
                    var img = (hos.hospitalPicture)?hos.hospitalPicture: '/static/images/hospital.png';
                    html += '<li class="hosItem" data-id="'+hos.hospitalId+'">' +
                        '            <div class="hosItem-left">' +
                        '                <img src="'+img+'" class="hosImg" />' +
                        '            </div>' +
                        '            <div class="hosItem-right">' +
                        '                <p class="address"><span class="hosName">'+hos.hospitalName+'</span><span class="hosLevel">'+hos.hospitalType+'</span></p>' +
                        '                <div class="hosItem-bottom">' +
                        '                    <span class="addDetail">'+hos.hospitalAddress+'</span>' +
                        '                    <p><img class="mark" src="/static/images/qyfw/mark.png" /><span>距您</span> <span class="hosItem-bottom-red">1.2</span><span>Km</span></p>\n' +
                        '                </div>' +
                        '            </div>' +
                        '        </li>'
                }
                $('.hosList').append(html)
            }
        });
    }
        window.onbeforeunload=function(e){
            sessionStorage.removeItem('hospitalName')
        }
</script>

</html>



